import { createSlice } from "@reduxjs/toolkit";
let CASLogin = createSlice({
    name: "CASLogin",
    initialState: {
        reportType: '年报',
        projectList: [],
        reportExtractProjectIdList: [],
        module: [],
        // 开发者模式
        useInspector: false,
        useMock: false,
        ticket: undefined
    },
    reducers: {
        setTicket: (state, action) => {
            state.ticket = action.payload
        },
        setReportType: (state, action) => {
            state.reportType = action.payload
        },
        setReportExtractProjectIdList: (state, action) => {
            state.reportExtractProjectIdList = action.payload;
        },
        setModule: (state, action) => {
            state.module = action.payload;
        },
        setProjectList: (state, action) => {
            const newState = JSON.parse(JSON.stringify(state))
            newState.projectList = action.payload;
            return newState
        },
        setuseInspector: (state, action) => {
            state.useInspector = action.payload
        },
        setMock: (state, action) => {
            state.useMock = action.payload
        }
    }
})
export const { setModule, setProjectList, setReportExtractProjectIdList, setReportType, setuseInspector, setTicket } = CASLogin.actions

export default CASLogin